#ifndef HTTP_H
#define HTTP_H

#include <QString>
#include <QNetworkRequest>
#include <QNetworkReply>

class Http
{
public:
    enum Method {
        GET = 0,
        HEAD,
        POST,
        PUT,
        DELETE,
    };

public:
    Http(QString url,
         Http::Method method);
    ~Http();
    void setHeader(QNetworkRequest::KnownHeaders header, const QVariant &value);
    void setData(QString &data);
    void setData(QByteArray data);
    void setRequest(QNetworkRequest request);
    QNetworkRequest getRequest();
    QNetworkAccessManager *getAccessManager();
    void send();

private:
    QNetworkAccessManager *manager;
    QNetworkRequest request;
    QByteArray data;
    Http::Method method;
};

#endif // HTTP_H
